<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>输入一个数，显示乘法表，确保输入有效性</title>
</head>
<body>
<script>
    var value;
    do {
        do {
            value = parseInt(prompt('Enter the time table', '-1'), 10);
        } while (isNaN(value));
        timesTable(value, 9);
    } while (value != -1);

    function timesTable(begin, end) {
        for (var i = begin; i <= end; i++) {
            document.write(begin + ' * ' + i + ' = ' + end * i + '<br/>');
        }
    }
</script>
</body>
</html>